home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS05.ADF / text / gameport < prev    next >
Text File  |  1986-01-15  |  17KB  |  437 lines

  1.  
  2.  Game Controller Interface Connector Specification
  3. --------------------------------------------------
  4.  
  5.  The two 9 pin D with pins (male) type connectors at the right of the 
  6.  Amiga nearer the front are used to interface to four types of devices:
  7.  
  8.        1.  Mouse or trackball, 3 buttons max
  9.        2.  Digital Joystick, 2 buttons max
  10.        3.  Proportional (pot or proportional joystick), 2 buttons max
  11.        4.  Light Pen, including pen-pressed-to-screen button
  12.  
  13.  The connector pin assignments will be discussed in sections organized by
  14.  similar hardware and/or software operating requirements as shown in the
  15.  previous list.  Signal names will follow those used in the appendices of
  16.  the hardware manual when possible.
  17.  
  18.  J11 is the right controller port connector (joy1dat, pot1dat).
  19.  J12 is the left controller port connector (joy0dat, pot0dat).
  20.  
  21.  
  22.      NOTE:  While most of the following hardware discussed is directly
  23.        accessable, hardware should be accessed through ROM kernal software.
  24.        This will keep future hardware changes transparent to the user.
  25.  
  26.  
  27.  Game Controller Interface to Mouse/Trackball Quadrature Inputs
  28. ----------------------------------------------------------------
  29.  
  30.  A mouse or trackball is a device that translates planar motion into
  31.  pulse trains.  Quadrature techniques are employed to preserve the
  32.  direction as well as magnitude of displacement.  The registers joy0dat
  33.  and joy1dat become counter registers, with y displacement in the high
  34.  byte and x in the low byte.  Movement causes the following action:
  35.  
  36.        up:    y decrements
  37.        down:  y increments
  38.        right: x increments
  39.        left:  x decrements
  40.  
  41.  To determine displacement, joyxdat is read twice with corresponding x
  42.  and y values subtracted (careful, modulo 128 arithmetic).  Note that if
  43.  either count changes by more than 127, both distance and direction become
  44.  ambiguous.  There is a relationship between the sampling interval and the
  45.  maximum speed (i.e. change in distance) that can be resolved as follows:
  46.  
  47.        Velocity < Distance(max) / SampleTime
  48.  
  49.        Velocity < SQRT(DeltaX**2 + DeltaY**2) / SampleTime
  50.  
  51.  For an Amiga with a 200 count per inch mouse sampling during each
  52.  vertical blanking interval, the maximum velocity in either the X or Y 
  53.  direction becomes:
  54.  
  55.      Velocity < (128 Counts * 1 inch/200 Counts) / .017 sec = 38 in/sec
  56.  
  57.  which should be sufficient for most users.
  58.  
  59.    NOTE:  The Amiga software is designed to do mouse update cycles during 
  60.      vertical blanking.  The horizontal and vertical counters are always 
  61.      valid and may be read at any time.
  62.  
  63.  Connector Pin Usage for Mouse/Trackball Quadrature Inputs
  64. -----------------------------------------------------------
  65.  pin   mnuemonic   description                    hardware register/notes
  66.  
  67.   1        V       Vertical Pulses                joy[0/1]dat<15:8>
  68.   2        H       Horiontal Pulses               joy[0/1]dat(7:0>
  69.   3        VQ      Vertical Quadrature Pulses     joy[0/1]dat<15:8>
  70.   4        HQ      Horizontal Quadrature Pulses   joy[0/1]dat<7:0>
  71.   5       UBUT*    Unused Mouse Button            See Proportional Inputs
  72.   6       LBUT*    Left Mouse Button              See Fire Button
  73.   7       +5V      125ma max, 200ma surge         total both ports
  74.   8      Ground
  75.   9       RBUT*    Right Mouse Button             See Proportional Inputs
  76.  
  77.  
  78.  Game Port Interface to Digital Joysticks
  79. --------------------------------------------------
  80.  
  81.  A joystick is a device with 4 normally opened switches arranged 90
  82.  degrees apart.  The joy[0/1]dat registers become encoded switch input ports
  83.  as follows:
  84.  
  85.      forward:  bit#9 xor bit#8
  86.      left:     bit#9
  87.      back:     bit#1 xor bit#0
  88.      right:    bit#1
  89.  
  90.  Data is encoded to facilitate the mouse/trackball operating mode.
  91.  
  92.    NOTE:  The right and left direction inputs are also designed to be
  93.      right and left buttons, respectively, for use with proportional
  94.      inputs.  In this case, the forward and back inputs are not used,
  95.      while right and left become button inputs rather than joystick inputs.
  96.  
  97.  The joy[0/1]dat registers are always valid and may be read at any time.
  98.  
  99.  Connector Pin Usage for Digital Joystick Inputs
  100. --------------------------------------------------
  101.  pin   mnuemonic   description                    hardware register/notes
  102.  
  103.   1     FORWARD*   Forward Joystick Switch        joy[0/1]dat<9 xor 8>
  104.   2      BACK*     Back Joystick Switch           joy[0/1]dat(1 xor 0>
  105.   3      LEFT*     Left Joystick Switch           joy[0/1]dat<9>
  106.   4      RIGHT*    Right Joystick Switch          joy[0/1]dat<1>
  107.   5      unused
  108.   6      FIRE*     Left Mouse Button              See Fire Button
  109.   7       +5V      125ma max, 200ma surge         total both ports
  110.   8      Ground
  111.   9      unused
  112.  
  113.  Game Port Interface to Fire Buttons
  114. --------------------------------------------------
  115.  
  116.  The fire buttons are normally opened switches routed to the 8520
  117.  adapter PRA0 as follows:
  118.  
  119.      PRA0 bit 7 = Fire* Left Controller Port
  120.      PRA0 bit 6 = Fire* Right Controller Port
  121.  
  122.  Before reading this register, the corresponding bits of the data
  123.  direction register must be cleared to define input mode:
  124.  
  125.      DDRA0<7:6> cleared as appropriate
  126.  
  127.    NOTE:  Do not disturb the settings of other bits in DDRA0 (Use of ROM 
  128.       kernal calls is recommended).
  129.  
  130.  Fire button are always valid and may be read at any time.
  131.  
  132.  Connector Pin Usage for Fire Button Inputs
  133. --------------------------------------------------
  134.  pin   mnuemonic   description
  135.  
  136.   1      -x-
  137.   2      -x-
  138.   3      -x-
  139.   4      -x-
  140.   5      -x-
  141.   6      FIRE*     Left Mouse Button/Fire Button
  142.   7      -x-
  143.   8      -x-
  144.   9      -x-
  145.  
  146.  
  147.  Game Port Interface to Proportional Controllers
  148. -------------------------------------------------------
  149.  
  150.  Resistive (potentiometer) element linear taper proportional controllers
  151.  are supported up to 528k Ohms max (470k +/- 10% recommended).  The
  152.  joy[0/1]dat registers contain digital translation values for y in the high
  153.  byte and x in the low byte.  A higher count value indicates a higher
  154.  external resistance.  The Amiga performs an intergrating analog to
  155.  digital conversion as follows:
  156.  
  157.    1. Pot[0/1]dat registers are reset and the analog input capacitors are
  158.       discharged for the first 7 (261 lines) or 8 (262 lines) horizontal
  159.       lines.
  160.    2. Once per horizontal line, each analog input is compared to an
  161.       internal reference.
  162.    3. Any counter whose analog input exceeds the reference stops incrementing.
  163.       The counter is stopped for the duration of the veritcal frame.
  164.    4. Any counter whose analog input is less than the reference continues
  165.       to increment.
  166.  
  167.  
  168.     NOTE:  The POTY and POTX inputs are designated as Right Mouse Button and
  169.         Unused Mouse button respectively.  An opened switch corresponds to
  170.         high resistance, a closed switch to a low resistance.  The buttons
  171.         are also available in potgo and potinp registers.  It is
  172.         recommended that ROM kernal call be used for future hardware
  173.         compatability.
  174.  
  175.  The pot[0/1]dat registers are typically read during video blanking, but
  176.  MAY be available prior to that.
  177.  
  178.  Connector Pin Usage for Proportional Inputs
  179. --------------------------------------------------
  180.  pin   mnuemonic   description              hardware register/notes
  181.  
  182.   1     unused
  183.   2     unused
  184.   3      LBUT*     Left Button              See Digital Joystick
  185.   4      RBUT*     Right Button             See Digital Joystick
  186.   5      POTX      X Analog In              pot[0/1]dat<7:0>, potgo, potinp
  187.   6     unused
  188.   7      +5V       125ma max, 200 ma surge
  189.   8     Ground
  190.   9      POTY      Y Analog In              pot[0,1]dat<15:8>, potgo, potinp
  191.  
  192.  
  193.  Game Port Interface to Light Pen
  194. --------------------------------------------------
  195.  
  196.  A light pen is an optoelectronic device whose light sensitive portion
  197.  is placed in proximity to a CRT.  As the electron beam sweeps past the
  198.  light pen, a trigger pulse is generated which can be enabled to latch the
  199.  horizontal and vertical beam positions.  There is no hardware bit to
  200.  indicate this trigger, but this can be determined in the two ways shown
  201.  in the Hardware Manual.
  202.  
  203.  Light pen position is usually read during blanking, but MAY be available
  204.  prior to that.
  205.  
  206.  Connector Pin Usage for Light Pen Inputs
  207. --------------------------------------------------
  208.  pin   mnuemonic   description              hardware register/notes
  209.  
  210.   1     unused
  211.   2     unused
  212.   3     unused
  213.   4     unused
  214.   5     LPENPR*    Light Pen Pressed        See Propotional Inputs
  215.   6     LPENTG*    Light Pen Trigger        vposr, vhposr
  216.   7      +5V       125ma max, 200 ma surge  both ports
  217.   8     Ground
  218.   9     unused
  219.  
  220.  Game Controller Interface Connector Specification
  221. --------------------------------------------------
  222.  
  223.  The two 9 pin D with pins (male) type connectors at the right of the 
  224.  Amiga nearer the front are used to interface to four types of devices:
  225.  
  226.        1.  Mouse or trackball, 3 buttons max
  227.        2.  Digital Joystick, 2 buttons max
  228.        3.  Proportional (pot or proportional joystick), 2 buttons max
  229.        4.  Light Pen, including pen-pressed-to-screen button
  230.  
  231.  The connector pin assignments will be discussed in sections organized by
  232.  similar hardware and/or software operating requirements as shown in the
  233.  previous list.  Signal names will follow those used in the appendices of
  234.  the hardware manual when possible.
  235.  
  236.  J11 is the right controller port connector (joy1dat, pot1dat).
  237.  J12 is the left controller port connector (joy0dat, pot0dat).
  238.  
  239.  
  240.      NOTE:  While most of the following hardware discussed is directly
  241.        accessable, hardware should be accessed through ROM kernal software.
  242.        This will keep future hardware changes transparent to the user.
  243.  
  244.  
  245.  Game Controller Interface to Mouse/Trackball Quadrature Inputs
  246. ----------------------------------------------------------------
  247.  
  248.  A mouse or trackball is a device that translates planar motion into
  249.  pulse trains.  Quadrature techniques are employed to preserve the
  250.  direction as well as magnitude of displacement.  The registers joy0dat
  251.  and joy1dat become counter registers, with y displacement in the high
  252.  byte and x in the low byte.  Movement causes the following action:
  253.  
  254.        up:    y decrements
  255.        down:  y increments
  256.        right: x increments
  257.        left:  x decrements
  258.  
  259.  To determine displacement, joyxdat is read twice with corresponding x
  260.  and y values subtracted (careful, modulo 128 arithmetic).  Note that if
  261.  either count changes by more than 127, both distance and direction become
  262.  ambiguous.  There is a relationship between the sampling interval and the
  263.  maximum speed (i.e. change in distance) that can be resolved as follows:
  264.  
  265.        Velocity < Distance(max) / SampleTime
  266.  
  267.        Velocity < SQRT(DeltaX**2 + DeltaY**2) / SampleTime
  268.  
  269.  For an Amiga with a 200 count per inch mouse sampling during each
  270.  vertical blanking interval, the maximum velocity in either the X or Y 
  271.  direction becomes:
  272.  
  273.      Velocity < (128 Counts * 1 inch/200 Counts) / .017 sec = 38 in/sec
  274.  
  275.  which should be sufficient for most users.
  276.  
  277.    NOTE:  The Amiga software is designed to do mouse update cycles during 
  278.      vertical blanking.  The horizontal and vertical counters are always 
  279.      valid and may be read at any time.
  280.  
  281.  Connector Pin Usage for Mouse/Trackball Quadrature Inputs
  282. -----------------------------------------------------------
  283.  pin   mnuemonic   description                    hardware register/notes
  284.  
  285.   1        V       Vertical Pulses                joy[0/1]dat<15:8>
  286.   2        H       Horiontal Pulses               joy[0/1]dat(7:0>
  287.   3        VQ      Vertical Quadrature Pulses     joy[0/1]dat<15:8>
  288.   4        HQ      Horizontal Quadrature Pulses   joy[0/1]dat<7:0>
  289.   5       UBUT*    Unused Mouse Button            See Proportional Inputs
  290.   6       LBUT*    Left Mouse Button              See Fire Button
  291.   7       +5V      125ma max, 200ma surge         total both ports
  292.   8      Ground
  293.   9       RBUT*    Right Mouse Button             See Proportional Inputs
  294.  
  295.  
  296.  Game Port Interface to Digital Joysticks
  297. --------------------------------------------------
  298.  
  299.  A joystick is a device with 4 normally opened switches arranged 90
  300.  degrees apart.  The joy[0/1]dat registers become encoded switch input ports
  301.  as follows:
  302.  
  303.      forward:  bit#9 xor bit#8
  304.      left:     bit#9
  305.      back:     bit#1 xor bit#0
  306.      right:    bit#1
  307.  
  308.  Data is encoded to facilitate the mouse/trackball operating mode.
  309.  
  310.    NOTE:  The right and left direction inputs are also designed to be
  311.      right and left buttons, respectively, for use with proportional
  312.      inputs.  In this case, the forward and back inputs are not used,
  313.      while right and left become button inputs rather than joystick inputs.
  314.  
  315.  The joy[0/1]dat registers are always valid and may be read at any time.
  316.  
  317.  Connector Pin Usage for Digital Joystick Inputs
  318. --------------------------------------------------
  319.  pin   mnuemonic   description                    hardware register/notes
  320.  
  321.   1     FORWARD*   Forward Joystick Switch        joy[0/1]dat<9 xor 8>
  322.   2      BACK*     Back Joystick Switch           joy[0/1]dat(1 xor 0>
  323.   3      LEFT*     Left Joystick Switch           joy[0/1]dat<9>
  324.   4      RIGHT*    Right Joystick Switch          joy[0/1]dat<1>
  325.   5      unused
  326.   6      FIRE*     Left Mouse Button              See Fire Button
  327.   7       +5V      125ma max, 200ma surge         total both ports
  328.   8      Ground
  329.   9      unused
  330.  
  331.  Game Port Interface to Fire Buttons
  332. --------------------------------------------------
  333.  
  334.  The fire buttons are normally opened switches routed to the 8520
  335.  adapter PRA0 as follows:
  336.  
  337.      PRA0 bit 7 = Fire* Left Controller Port
  338.      PRA0 bit 6 = Fire* Right Controller Port
  339.  
  340.  Before reading this register, the corresponding bits of the data
  341.  direction register must be cleared to define input mode:
  342.  
  343.      DDRA0<7:6> cleared as appropriate
  344.  
  345.    NOTE:  Do not disturb the settings of other bits in DDRA0 (Use of ROM 
  346.       kernal calls is recommended).
  347.  
  348.  Fire button are always valid and may be read at any time.
  349.  
  350.  Connector Pin Usage for Fire Button Inputs
  351. --------------------------------------------------
  352.  pin   mnuemonic   description
  353.  
  354.   1      -x-
  355.   2      -x-
  356.   3      -x-
  357.   4      -x-
  358.   5      -x-
  359.   6      FIRE*     Left Mouse Button/Fire Button
  360.   7      -x-
  361.   8      -x-
  362.   9      -x-
  363.  
  364.  
  365.  Game Port Interface to Proportional Controllers
  366. -------------------------------------------------------
  367.  
  368.  Resistive (potentiometer) element linear taper proportional controllers
  369.  are supported up to 528k Ohms max (470k +/- 10% recommended).  The
  370.  joy[0/1]dat registers contain digital translation values for y in the high
  371.  byte and x in the low byte.  A higher count value indicates a higher
  372.  external resistance.  The Amiga performs an intergrating analog to
  373.  digital conversion as follows:
  374.  
  375.    1. Pot[0/1]dat registers are reset and the analog input capacitors are
  376.       discharged for the first 7 (261 lines) or 8 (262 lines) horizontal
  377.       lines.
  378.    2. Once per horizontal line, each analog input is compared to an
  379.       internal reference.
  380.    3. Any counter whose analog input exceeds the reference stops incrementing.
  381.       The counter is stopped for the duration of the veritcal frame.
  382.    4. Any counter whose analog input is less than the reference continues
  383.       to increment.
  384.  
  385.  
  386.     NOTE:  The POTY and POTX inputs are designated as Right Mouse Button and
  387.         Unused Mouse button respectively.  An opened switch corresponds to
  388.         high resistance, a closed switch to a low resistance.  The buttons
  389.         are also available in potgo and potinp registers.  It is
  390.         recommended that ROM kernal call be used for future hardware
  391.         compatability.
  392.  
  393.  The pot[0/1]dat registers are typically read during video blanking, but
  394.  MAY be available prior to that.
  395.  
  396.  Connector Pin Usage for Proportional Inputs
  397. --------------------------------------------------
  398.  pin   mnuemonic   description              hardware register/notes
  399.  
  400.   1     unused
  401.   2     unused
  402.   3      LBUT*     Left Button              See Digital Joystick
  403.   4      RBUT*     Right Button             See Digital Joystick
  404.   5      POTX      X Analog In              pot[0/1]dat<7:0>, potgo, potinp
  405.   6     unused
  406.   7      +5V       125ma max, 200 ma surge
  407.   8     Ground
  408.   9      POTY      Y Analog In              pot[0,1]dat<15:8>, potgo, potinp
  409.  
  410.  
  411.  Game Port Interface to Light Pen
  412. --------------------------------------------------
  413.  
  414.  A light pen is an optoelectronic device whose light sensitive portion
  415.  is placed in proximity to a CRT.  As the electron beam sweeps past the
  416.  light pen, a trigger pulse is generated which can be enabled to latch the
  417.  horizontal and vertical beam positions.  There is no hardware bit to
  418.  indicate this trigger, but this can be determined in the two ways shown
  419.  in the Hardware Manual.
  420.  
  421.  Light pen position is usually read during blanking, but MAY be available
  422.  prior to that.
  423.  
  424.  Connector Pin Usage for Light Pen Inputs
  425. --------------------------------------------------
  426.  pin   mnuemonic   description              hardware register/notes
  427.  
  428.   1     unused
  429.   2     unused
  430.   3     unused
  431.   4     unused
  432.   5     LPENPR*    Light Pen Pressed        See Propotional Inputs
  433.   6     LPENTG*    Light Pen Trigger        vposr, vhposr
  434.   7      +5V       125ma max, 200 ma surge  both ports
  435.   8     Ground
  436.   9     unused
  437.